package com.atguigu.controller;


import com.atguigu.prop.DataSourceConfigurationProperties;
import com.atguigu.prop.DataSourceProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/hello")
@RestController
@EnableConfigurationProperties(DataSourceConfigurationProperties.class)
public class HelloController {

    @GetMapping("/h01")
    public String h01(){
        return "Hello SpringBoot!";
    }
    @Autowired
    private DataSourceProperties dataSourceProperties;

    @GetMapping("/h02")
    public Object h02(){
        return dataSourceProperties;
    }

    @Autowired
    private DataSourceConfigurationProperties dataSourceConfigurationProperties;

    @GetMapping("/h03")
    public Object h03(){
        return dataSourceConfigurationProperties;
    }
}
